///<reference path="BaseLifecycleObj.ts"/>
///<reference path="BaseContextObj.ts"/>
/**
 * Created by PengWei on 2018/7/24.
 */
namespace mengdao {
    import BaseContextObj = game.BaseContextObj;

    /**
     *  复合Context的基类
     */
    export class BaseInjector extends BaseContextObj {
        /**
         * @param {mengdao.Context} context
         */
        public constructor(context: Context) {
            super();
            this.context = context;
            if (this._context.isActive) {
                this.initInjection();
            } else {
                this._context.once(ContextEvent.INITIALIZE, this.onContextInitialize, this);
            }
        }

        /**
         * context初始化完毕，所有的常量已注入完成a
         * @param {mengdao.ContextEvent} e
         */
        private onContextInitialize(e: ContextEvent): void {
            this.initInjection();
        }

        protected initInjection(): void {
        }
    }
}